#include <stdio.h>
#include <math.h>

int myGCD(int a, int b);
int main(void)
{
	int a,b;
	printf("Please input two number:");
	scanf("%d%d",&a,&b);
	printf("a = %d and b = %d.\n", a, b);
	printf("The GCD of %d and %d is %d.\n", a, b, myGCD(a,b));
        return 0;
}

int myGCD(int a, int b)
{	
	a = fabs(a);
	b = fabs(b);
	if(a < b)
	{
		int change = a;
		a = b;
		b = change;
	}
	while(a%b)
	{
		if(a < b)
		{
			int change = a;
			a = b;
			b = change;
		}
		int change = a;
		a = b;
		b = change % b;
	}
		
	return b;
}
